include (ValaVersion)

include (ValaPrecompile)

add_subdirectory(libauto)

include_directories(${CMAKE_CURRENT_BINARY_DIR}/libauto)

include_directories (${DEPS_INCLUDE_DIRS})

add_definitions (${DEPS_CFLAGS})

link_directories (${DEPS_LIBRARY_DIRS})

set (APP_SOURCES ${APP_SOURCES} main.vala)

find_package (Vala REQUIRED)

vala_precompile(VALA_C auto_test
    ${APP_SOURCES}
PACKAGES
	${VALA_PACKAGES}
CUSTOM_VAPIS
    ${CMAKE_CURRENT_BINARY_DIR}/libauto/libauto.vapi
)

set(target_name auto_test)

add_executable(${target_name} ${VALA_C})

target_link_libraries(${target_name} ${DEPS_LIBRARIES} auto)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FixBundle.cmake.in
               ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake
               @ONLY)

install(TARGETS ${target_name} DESTINATION bin)

install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake)
